/**
 * components/Row.js
 * Define your component using platform-independent primitives
 */
import React from "react";

import { StyleSheet, Text } from "react-native";
import PropTypes from "prop-types";

import { Color, FontSize } from "../../common/index";

const HeaderTitleText = props => {
  const { title, color } = props;
  return title ? (
    <Text style={[styles.text, { color }]} numberOfLines={1}>
      {title}
    </Text>
  ) : null;
};

HeaderTitleText.propTypes = {
  title: PropTypes.string.isRequired,
  color: PropTypes.string,
};

HeaderTitleText.defaultProps = {
  color: Color.black,
};

const styles = StyleSheet.create({
  text: {
    fontSize: FontSize.SIZE_18,
    fontWeight: "bold",
    flex: 1,
    textAlign: "center",
  },
});
export default HeaderTitleText;
